import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:full_display/common/qxp_style.dart';
import 'package:full_display/generated/l10n.dart';
import 'package:full_display/unit/asset_utils/asset_utils.dart';
import 'package:full_display/unit/screen/screen_utility.dart';
import 'package:package_info_plus/package_info_plus.dart';

class SingleNoDevicePage extends StatefulWidget {
  const SingleNoDevicePage({super.key});

  @override
  State<SingleNoDevicePage> createState() => _SingleNoDevicePageState();
}

class _SingleNoDevicePageState extends State<SingleNoDevicePage> {
  PackageInfo _packageInfo = PackageInfo(
    appName: 'Unknown',
    packageName: 'Unknown',
    version: '1.0.1',
    buildNumber: 'Unknown',
    buildSignature: 'Unknown',
    installerStore: 'Unknown',
  );
  @override
  void initState() {
    super.initState();
    _initPackageInfo();
  }

  @override
  Widget build(BuildContext context) {
    return Align(
      alignment: Alignment(0, -0.3),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Image.asset(
            height: 145.0.H,
            width: 190.0.W,
            AssetUtils.getAsset2Image("wifi"),
          ),
          Container(
            height: 60.0.H,
          ),
          Text(S.of(context).adddeviceright,
              textAlign: TextAlign.center,
              style: StandardTextStyle.textWhite17Style),
          Container(
            height: 30.0.H,
          ),
          Text(
            'Version ${_packageInfo.version}',
            textAlign: TextAlign.center,
            style: StandardTextStyle.textWhite17Style,
          ),
        ],
      ),
    );
  }

  void _initPackageInfo() async {
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    setState(() {
      _packageInfo = packageInfo;
    });
  }
}
